package cn.dengta.webapp.push.dto;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.Assert;
import me.codeplayer.util.X;

@Schema(description = "用户组")
@Getter
@Setter
@Accessors(chain = true)
public class UserGroupDTO {

	@Schema(description = "聊天组ID", example = "2", required = true)
	@NotNull
	protected Long groupId;

	@Schema(description = "用户ID数组", example = "[6026301346]", required = true)
	@NotEmpty
	protected Long[] userIds;

	public static UserGroupDTO of(Long groupId, Long... userIds) {
		Assert.isTrue(X.isValid(userIds));
		return new UserGroupDTO().setGroupId(groupId).setUserIds(userIds);
	}

}
